<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>

  <meta content="text/html; charset=UTF-8" http-equiv="content-type">

<title>Bauer stereophonic-to-binaural DSP</title>














  
  <meta content="Boris Mikhaylov" name="author"></head><body style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" vlink="#990099" alink="#000099" link="#000099">
<table style="width: 800px; text-align: left; font-family: times new roman,times,serif;" border="0" cellpadding="2" cellspacing="2">
  <tbody>
    <tr>
      <td style="vertical-align: top;"><big><span style="font-weight: bold;">Bauer stereophonic-to-binaural DSP: library
description.</span></big><br>
      <br>
The <a href="http://bs2b.sourceforge.net/" target="_top">bs2b</a>
library is simple
to use. See tables 1 and 2 for example. It is a reductive code of
'bs2bstream.c'. The 'bs2b.h' and 'bs2bclass.h' files
of the source code
package can help also.<br>
You can use a 'bs2bstream' with '<a href="http://lame.sourceforge.net/" target="_top">lame</a>' by a command line like this:<br>&nbsp; lame -t --decode test.wav - | bs2bstream | lame -r -x -m j -s 44.1 --bitwidth 16 --preset extreme - test.mp3<br>
or without of '-x' swap bytes of input file, like this:<br>&nbsp; lame -t --decode test.wav - | bs2bstream | lame -r -m j -s 44.1 --bitwidth 16 --preset extreme - test.mp3<br><br>
      <span style="font-weight: bold;">Table 1. Example of using of bs2b
library (C).</span><br>
      <table style="width: 100%; background-color: rgb(255, 255, 204); text-align: left; font-family: courier new,courier,monospace;" border="0" cellpadding="2" cellspacing="2">
        <tbody>
          <tr>
            <td style="vertical-align: top;"><font size="-2">#include &lt;stdio.h&gt;<br>
#include "bs2b.h"<br>
            <br>
int main()<br>
{<br>
&nbsp; t_bs2bdp bs2bdp;<br>
&nbsp; short sample[ 2 ];<br>
            <br>
&nbsp; bs2bdp = bs2b_open();<br>
            <br>
&nbsp; /* Default init value<br>
&nbsp; bs2b_set_srate( bs2bdp, 44100 );<br>
&nbsp; bs2b_set_level( bs2bdp, BS2B_DEFAULT_CLEVEL ); // 700 Hz, 4.5 dB<br>
&nbsp; // or another way<br>
&nbsp; bs2b_set_srate( bs2bdp, 44100 );<br>
&nbsp; bs2b_set_level_fcut( bs2bdp, 700 ); // 700 Hz<br>
&nbsp; bs2b_set_level_feed( bs2bdp, 45 );&nbsp; // 4.5 dB<br>
&nbsp; */<br>
            <br>
&nbsp; /* raw LPCM, signed 16 bit, native to CPU byte order, stereo interleaved */<br>
&nbsp; while( 2 == fread( sample, sizeof( short ), 2, stdin ) )<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; bs2b_cross_feed_s16( bs2bdp, sample );<br>
&nbsp;&nbsp;&nbsp; fwrite( sample, sizeof( short ), 2, stdout );<br>
&nbsp; }<br>
            <br>
&nbsp; bs2b_close( bs2bdp );<br>
&nbsp; bs2bdp = 0;<br>
            <br>
&nbsp; return 0 ;<br>
}<br>
            </font> </td>
          </tr>
        </tbody>
      </table>
      <br>Sample
rate default value is 44100 Hz. Crossfeed level default value is 700
Hz, 4.5 dB. If a sample rate of audio data is different or if you
want to
change
crossfeed level then you must call 'bs2b_set_srate' and
'bs2b_set_level' functions (or 'bs2b_set_srate', 'bs2b_set_level_fcut',
'bs2b_set_level_feed') accordingly.<br>
      <br>
      <span style="font-weight: bold;">Table 2. Example of using of bs2b
library (C++).</span><br>

      
      <table style="width: 100%; background-color: rgb(255, 255, 204); text-align: left; font-family: courier new,courier,monospace;" border="0" cellpadding="2" cellspacing="2">

        <tbody>
          <tr>
            <td style="vertical-align: top;"><font size="-2">#include &lt;stdio.h&gt;<br>
#include "bs2bclass.h"<br>
            <br>
int main()<br>
{<br>
&nbsp; bs2b_base bs2b;<br>
            <br>
&nbsp; // Default init value<br>
&nbsp; //bs2b.set_srate( 44100 );<br>
&nbsp; //bs2b.set_level( BS2B_DEFAULT_CLEVEL ); // 700 Hz, 4.5 dB<br>
&nbsp; // or another way<br>
&nbsp; //bs2b.set_srate( 44100 );<br>
&nbsp; //bs2b.set_level_fcut( 700 ); // 700 Hz<br>
&nbsp; //bs2b.set_level_feed( 45 );&nbsp; // 4.5 dB<br>
            <br>
&nbsp; // raw LPCM, signed 16 bit, native to CPU byte order, stereo interleaved<br>
&nbsp; short sample[ 2 ];<br>
&nbsp; while( 2 == fread( sample, sizeof( short ), 2, stdin ) )<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; bs2b.cross_feed( sample );<br>
&nbsp;&nbsp;&nbsp; fwrite( sample, sizeof( short ), 2, stdout );<br>
&nbsp; }<br>
            <br>
&nbsp; return 0 ;<br>
}</font><br>
</td>
          </tr>
        </tbody>
      
      </table>

      <br>
      <hr style="width: 100%; height: 2px;">Copyright (c) 2005-2010&nbsp;
Boris Mikhaylov &lt; <a href="http://www.tmn.ru/%7Ebor" target="_top">http://www.tmn.ru/~bor</a>&gt;</td>
    </tr>
  </tbody>
</table>
</body></html>